/**
 * Created by Administrator on 2017/9/8.
 */

let variable = require('../data/variable.js');
let bluedSDK = require('../util/bluedSDK.js');
let call = require('./call.js');
let mem = require('../util/mem.js');

let exit = module.exports;

exit.allUserExit = function (cb) {
    let max = Object.keys(mem.blueds).length;
    if (max == 0) {
        cb();
        return false;
    }
    let count = 0;
    for (let i in mem.blueds) {
        bluedSDK.status(mem.blueds[i].accessToken, variable.blued.statusExit, function (result) {
            count++;
            // console.log('bluedSDK.status', result);
            if (count >= max) {
                cb();
            }
        });
    }
};